# Copyright (C) 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "go_default_library",
    srcs = [
        "alignof_sizeof.go",
        "allocator.go",
        "blob.go",
        "data.go",
        "decoder.go",
        "doc.go",
        "encoder.go",
        "id.go",
        "load.go",
        "pointer.go",
        "pool.go",
        "pool_write.go",
        "range.go",
        "range_list.go",
        "read.go",
        "resource.go",
        "slice.go",
        "store.go",
        "subslice.go",
        "types.go",
        "write.go",
        "writer.go",
    ],
    embed = [":memory_go_proto"],
    importpath = "github.com/google/gapid/gapis/memory",
    visibility = ["//visibility:public"],
    deps = [
        "//core/data:go_default_library",
        "//core/data/binary:go_default_library",
        "//core/data/endian:go_default_library",
        "//core/data/id:go_default_library",
        "//core/data/slice:go_default_library",
        "//core/math/interval:go_default_library",
        "//core/math/u64:go_default_library",
        "//core/os/device:go_default_library",
        "//gapis/database:go_default_library",
        "@com_github_pkg_errors//:go_default_library",
    ],
)

go_test(
    name = "go_default_test",
    size = "small",
    srcs = [
        "allocator_test.go",
        "pool_test.go",
        "write_test.go",
    ],
    embed = [":go_default_library"],
    deps = [
        "//core/assert:go_default_library",
        "//core/data/endian:go_default_library",
        "//core/data/id:go_default_library",
        "//core/log:go_default_library",
        "//core/math/interval:go_default_library",
        "//core/os/device:go_default_library",
        "//gapis/database:go_default_library",
        "@com_github_pkg_errors//:go_default_library",
    ],
)

proto_library(
    name = "memory_proto",
    srcs = ["memory.proto"],
    visibility = ["//visibility:public"],
)

go_proto_library(
    name = "memory_go_proto",
    importpath = "github.com/google/gapid/gapis/memory",
    proto = ":memory_proto",
    visibility = ["//visibility:public"],
)

java_proto_library(
    name = "memory_java_proto",
    visibility = ["//visibility:public"],
    deps = [":memory_proto"],
)
